<%@page import="dbpedia.QueryPedia"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.Iterator"%>
<%@page import="com.hp.hpl.jena.query.*"%>

	<%
	String param= request.getParameter("q");
	
	String s[]= param.split(";");
	ArrayList<String> a= new ArrayList<String>();
	for(int i=0;i<s.length;i++){
		a.add(s[i]);
	}
	
	QueryPedia q= new QueryPedia();
	ArrayList<String> res=q.runQuery(a);
	
	out.println("<br><h2>Wikipedia Articles Collected for You:</h2> <br><br>");
	Iterator<String> it= res.iterator();
	int i=1;
	out.println("<form>");
	while(it.hasNext()){
		String link= it.next();
                String temp[] = link.split("/");
                String articleName= temp[temp.length-1];
		out.println(i+". "+"<a href=\"translate.jsp?q="+link+"\">"+articleName+"</a><br>");
		out.println();
		i++;
	}
	out.println("</form>");
	%>